{% macro nav_cate(nav) %}
    {% if nav.id == data.currentcateid  %}
    <li ><a href = "{{ nav.url }}" class="tab_current">{{ nav.name }}</a></li>
    {% else %}
    <li ><a href = "{{ nav.url }}" class="tab"> {{ nav.name }}</a></li>
    {% endif %}
{% endmacro %}

{% macro nav_subcate(nav) %}
    <li ><a href = "{{ nav.url }}" > {{ nav.name }}</a></li>
{% endmacro %}

{% macro list_post(post) %}
<div class="cell post_list">
    <div class="comments fr " style="height:48px;margin:0px;padding:0px;"><a href="/post/{{post.id}}" class="count_livid">{{ post.comments }}</a></div>
    <div class="post_item" style="height:48px;margin:0px;padding:0px;margin-left:10px;">
        <div class="post_item_label">
            {% if post.author %}
            <img alt="image" class="img-circle" src="{{ post.author.avatar }}">
            {% else %}
            <img alt="image" class="img-circle" src="/static/img/avatar.jpg">
            {% endif %}
        </div>
        <div class="post_item_content">
            <a href="/post/{{post.id}}">{{ post.title }}</a>
            <div class="sep5"></div>
            <div class="small fade">
                <div class="votes"></div>
                <a class="node" href="/subcate/{{post.subcateid}}">{{post.cate.name }}</a>&nbsp;•&nbsp;
                <strong><a href="/user/{{post.author.id}}">{{post.author.name}}</a></strong>
                &nbsp;•&nbsp;{{post.last_comment_time}}前&nbsp;•&nbsp;最后回复来自 
                <strong><a href="/user/{{post.last_comment_authorid}}">{{post.last_comment_author_name}}</a></strong>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>
{% endmacro %}

{% macro list_cate(cate) %}
<div class="cell row">
    <div class="col-md-1" style="padding-right:1px;">
        <span class="fade">{{ cate.name }}</span>
    </div>
    <div class="col-md-11" style="padding-left:1px;">
    {% for s in cate.subs %}
        <a href="/subcate{{s.id }}">{{ s.name }}</a>
    {% endfor %}
    </div>
</div>
{% endmacro %}

{% macro list_comment(comments) %}
    {% for c in comments %}
    <div class="cell post_list">
        <div class="comments fr " style="height:48px;margin:0px;padding:0px;"><a href="#" class="count_livid">{{ loop.index }}</a></div>
        <div class="comment_item" style="margin:0px;padding:0px;margin-left:10px;">
            <div class="comment_item_label">
                <img alt="image" class="img-circle" src="/static/img/avatar.jpg">
            </div>
            <div class="comment_item_content">
                <div class="small fade">
                    <div class="votes"></div>
                    <strong><a href="/user/{{c.author_id}}">{{c.author_id}}</a></strong>
                    &nbsp;•&nbsp;{{c.pub_time}}前&nbsp;•&nbsp;<span class="small fade"></span>&nbsp;•&nbsp;<span class="small fade">♥ 22</span>
                </div>
                <div class="sep5"></div>
                <div class="content">
                    {{ c.content_html|safe}}
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </div>
    {% endfor %}
{% endmacro %}


